#ifndef GRAPHNODEITEM_H
#define GRAPHNODEITEM_H

 #include <QGraphicsTextItem>
 #include <QSet>

QT_BEGIN_NAMESPACE
class QWidget;
class Arrow;
QT_END_NAMESPACE

class GraphScene;

class GraphNodeItem : public QGraphicsTextItem
{
private:
	QSet<Arrow*> _arrows;
	GraphScene *_scene;
	bool _deleted;
public:
	void addArrow(Arrow *arrow);
	void deleteArrow(Arrow *arrow);
	QRectF boundingRect() const;	
protected:
	GraphNodeItem(GraphScene *scene);
	~GraphNodeItem();
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
	bool contains (const QPointF& point) const;
	void focusOutEvent(QFocusEvent *event);
	void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
	void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
};

#endif // GRAPHNODEITEM_H
